package com.bao.shop.entity;

/**
 * @author baoye
 * @date 2024-07-25/16:33
 */
public class User {
    private String userName;//不能重复
    private String password;//大于等于6位
    private String otherName;
    private Integer age;

    public User(String userName, String password, String otherName, Integer age) {
        this.userName = userName;
        this.password = password;
        this.otherName = otherName;
        this.age = age;
    }

    public User() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        User user = (User) o;

        return userName != null ? userName.equals(user.userName) : user.userName == null;
    }

    @Override
    public int hashCode() {
        return userName != null ? userName.hashCode() : 0;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getOtherName() {
        return otherName;
    }

    public void setOtherName(String otherName) {
        this.otherName = otherName;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "用户名: " + userName+"\t昵称: " + otherName+ " \t 年龄:" + age;
    }
}
